using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
using SSOConfigTool.Windows.Enums;

namespace SSOConfigTool.Windows
{
    public partial class frmXMLFilename : Form
    {
        public frmXMLFilename()
        {
            InitializeComponent();
        }

        private string _xmlFilePath = null;

        public string XMLFilePath
        {
            get { return this._xmlFilePath; }
        }

        private void btnFile_Click(object sender, EventArgs e)
        {
            this.Dialog.Filter = "SSOConfig files (*.ssoconfig)|*.ssoconfig|XML files (*.xml)|*.xml|All files (*.*)|*.*";
            if (this.Dialog.ShowDialog() == DialogResult.OK)
            {
                this.txtFilename.Text = this.Dialog.FileName;
            }
        }

        private void ucOKCancel1_OKClicked_1()
        {
            this._xmlFilePath = this.txtFilename.Text;
            this.Close();
        }

        private void ucOKCancel1_CancelClicked()
        {
            this.Close();
        }

        private FileDialog Dialog
        {
            get
            {
                FileDialog dialog = null;
                switch (this._mode)
                {
                    case XmlMode.Load:
                        dialog = this.openFileDialog1;
                        break;
                    case XmlMode.Save:
                        dialog = this.saveFileDialog1;
                        break;
                }
                return dialog;
            }
        }
        private XmlMode _mode;
        public XmlMode Mode
        {
            get { return this._mode; }
            set { this._mode = value; }
        }
        
    }

}